package com.xiaoshuidi.cloud.module.contract.controller.app.invoice.vo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.stream.Stream;

@Data
public class InvoiceRespVO {
    /**
     * 可开票金额类型1租金2其它费用
     */
    @Schema(description = "可开票金额类型1租金2其它费用")
    private Integer invoiceFeeType;
    @Schema(description = "账单开始时间")
    private LocalDate startTime;
    @Schema(description = "账单结束时间")
    private LocalDate endTime;
    @Schema(description = "门店id")
    private Long apartmentId;
    @Schema(description = "账单id")
    private Long orderId;
    @Schema(description = "账单编号")
    private String orderNo;
    @Schema(description = "门店名称")
    private String apartmentName;
    @Schema(description = "房间名称")
    private String roomName;
    @Schema(description = "付款时间")
    private LocalDateTime actualPayTime;
    @Schema(description = "账单金额")
    private BigDecimal totalAmount;
    @Schema(description = "可开票金额")
    private BigDecimal invoicableAmount;
    @Schema(description = "费用明细id(多个是逗号分隔)")
    private String feeDetailId;
    @Schema(description = "租客名字")
    private String customerName;
    @JsonIgnore
    public Stream<Long> getFeeIdStream() {
        return StringUtils.isNotBlank(feeDetailId) ? Stream.of(feeDetailId.split(",")).map(Long::valueOf) : Stream.empty();
    }
}
